//
//  UIViewController+AlertAddtion.m
//  Backhome
//
//  Created by kwep_vbn on 2017/4/18.
//  Copyright © 2017年 SmartHome. All rights reserved.
//

#import "UIViewController+KNAlertAddtion.h"
#import "CYAlertView.h"

@implementation UIViewController (KNAlertAddtion)

- (void)KNShowPromptWithTitle:(NSString *)title
                    message:(NSString *)message
                     cancel:(NSString *)cancel
                      other:(NSString *)other
            completionBlock:(void(^)(BOOL result))block
{
    CYAlertView *alert = [[CYAlertView alloc] initWithTitle:title message:message
                                               clickedBlock:^(CYAlertView *alertView, BOOL cancelled, NSInteger buttonIndex) {
                                                   if (block) {
                                                       block(!cancelled);
                                                   }
                                               }
                                          cancelButtonTitle:cancel
                                          otherButtonTitles:other,nil];
    [alert show];
}

- (void)KNShowNormalWithTitle:(NSString *)title
                    message:(NSString *)message
             comletionBlock:(void(^)(BOOL save))block
{
    CYAlertView *alert = [[CYAlertView alloc] initWithTitle:title message:message
                                               clickedBlock:^(CYAlertView *alertView, BOOL cancelled, NSInteger buttonIndex) {
                                                   if (block) {
                                                       block(!cancelled);
                                                   }
                                               }
                                          cancelButtonTitle:@"确定"
                                          otherButtonTitles:nil];
    [alert show];
}


@end
